package com.cqut.forum.entity;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * @author yangxun
 * ArticleReply entity
 */
@Entity
@Table(name = "article_reply", catalog = "forum")
public class ArticleReply implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer articleReplyId;
	private Article article;
	private Integer userId;
	private String articleReplyContents;
	private Date articleReplyTime;
	//private Integer aboveReplyId;
	private Boolean articleReplyState;
	// Constructors

	/** default constructor */
	public ArticleReply() {
	}

	/** full constructor */
	public ArticleReply(Article article, Integer userId,
			String articleReplyContents, Date articleReplyTime,
			/*Integer aboveReplyId,*/ Boolean articleReplyState) {
		this.article = article;
		this.userId = userId;
		this.articleReplyContents = articleReplyContents;
		this.articleReplyTime = articleReplyTime;
		//this.aboveReplyId = aboveReplyId;
		this.articleReplyState = articleReplyState;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "article_reply_id", unique = true, nullable = false)
	public Integer getArticleReplyId() {
		return this.articleReplyId;
	}

	public void setArticleReplyId(Integer articleReplyId) {
		this.articleReplyId = articleReplyId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "article_id")
	public Article getArticle() {
		return this.article;
	}

	public void setArticle(Article article) {
		this.article = article;
	}

	@Column(name = "user_id")
	public Integer getUserId() {
		return this.userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	@Column(name = "article_reply_contents", length = 500)
	public String getArticleReplyContents() {
		return this.articleReplyContents;
	}

	public void setArticleReplyContents(String articleReplyContents) {
		this.articleReplyContents = articleReplyContents;
	}

	@Column(name = "article_reply_time", length = 10)
	public Date getArticleReplyTime() {
		return this.articleReplyTime;
	}

	public void setArticleReplyTime(Date articleReplyTime) {
		this.articleReplyTime = articleReplyTime;
	}

	/*@Column(name = "above_reply_id")
	public Integer getAboveReplyId() {
		return this.aboveReplyId;
	}

	public void setAboveReplyId(Integer aboveReplyId) {
		this.aboveReplyId = aboveReplyId;
	}*/
	@Column(name = "article_reply_state")
	public Boolean getArticleReplyState() {
		return articleReplyState;
	}

	public void setArticleReplyState(Boolean articleReplyState) {
		this.articleReplyState = articleReplyState;
	}
}